﻿<UserControl x:Class="ODAF.SilverlightApp.CommentView"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" 
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" 
    Width="380" Height="400">

    <Grid x:Name="LayoutRoot">
        <StackPanel Orientation="Vertical">
            <Border BorderBrush="Gray" Background="#EFEFEF" CornerRadius="4" Margin="0,0,0,-1" Padding="4" Width="380" Height="350">
                <Grid  Margin="0">
                    <StackPanel x:Name="CommentOutput" Orientation="Vertical" HorizontalAlignment="Left" Margin="0">
                        <TextBlock x:Name="tbTitle" 
                                   FontWeight="Bold" 
                                   TextAlignment="Left"
                                   Width="340"
                                   HorizontalAlignment="Left"
                                   Margin="0,4,0,4">Comments</TextBlock>
                        <!--<StackPanel Orientation="Horizontal" HorizontalAlignment="Stretch">-->
                            <Grid Width="372">
                                <Grid.ColumnDefinitions>
                                    <ColumnDefinition Width="200"></ColumnDefinition>
                                    <ColumnDefinition Width="*"></ColumnDefinition>
                                </Grid.ColumnDefinitions>

                            <StackPanel Orientation="Horizontal" Grid.Column="0" VerticalAlignment="Center" >


                                <TextBlock x:Name="tbCommentListLabel" 
                                           VerticalAlignment="Center" 
                                           Margin="4" 
                                           Width="164"
                                           Text="No Comments"/>

                                <Image x:Name="tweetImage" 
                                       Source="Images/Twitter.png" 
                                       Visibility="Collapsed"  
                                       Stretch="UniformToFill"
                                       Width="24" Height="24"
                                       HorizontalAlignment="Right"
                                       ToolTipService.ToolTip="Tweet about this landmark."
                                       MouseLeftButtonUp="TwitterImage_MouseLeftButtonUp"/>

                            </StackPanel>
                                <Grid Grid.Column="1">   
                                    <HyperlinkButton x:Name="AddBtn" 
                                                     Visibility="Collapsed"
                                                     HorizontalAlignment="Right" 
                                                     Click="AddBtn_Click" 
                                                     Content="[+] Add a Comment" />
                                
                                <TextBlock x:Name="signinHint" 
                                            HorizontalAlignment="Right"
                                            Foreground="Gray">Sign in to add a comment.</TextBlock>

                            </Grid>
                            </Grid>
                        <!--</StackPanel>-->
                        <ListBox x:Name="lbComments" 
                                 Height="280" Width="372"
                                 Margin="0,8,0,8" >
                            <ListBox.ItemTemplate>
                                <DataTemplate>
                                    <StackPanel Orientation="Vertical" HorizontalAlignment="Left" Margin="0">
                                        <TextBlock Text="{Binding Text}" TextWrapping="Wrap"
                                                   Width="322"/>
                                        <Grid Width="322">
                                            <TextBlock Text="{Binding CommentAuthor}" 
                                                       Foreground="#999"
                                                       TextAlignment="Left"/>
                                            <TextBlock Text="{Binding FormattedDate}"
                                                       Foreground="#999"
                                                       TextAlignment="Right"/>
                                        </Grid>
                                    </StackPanel>
                                </DataTemplate>
                            </ListBox.ItemTemplate>

                        </ListBox>
                    </StackPanel>
                    
                    <StackPanel x:Name="CommentEntry" Orientation="Vertical" HorizontalAlignment="Stretch" Margin="0">
                        <TextBlock FontWeight="Bold" TextAlignment="Left" Width="360">Add Comment</TextBlock>
                        <TextBox x:Name="tbCommentEntry" 
                                 TextWrapping="Wrap" 
                                 VerticalScrollBarVisibility="Auto" 
                                 Height="280" 
                                 Margin="0,8,0,8" 
                                 AcceptsReturn="True"
                                 MaxLength="1000">
                            
                        </TextBox>
                        <StackPanel Orientation="Horizontal" 
                                    VerticalAlignment="Center"
                                    Width="360"
                                    Margin="0,4,0,4">
                            <CheckBox x:Name="cbAutoTweet"
                                      Width="208"
                                      Content="also post to twitter"/>
                            
                            <Button Content="Save" 
                                    Width="72"
                                    Margin="4,0,4,0"
                                    Click="Save_Click"/>
                            <Button Content="Cancel" 
                                    Width="72"
                                    Click="Cancel_Click"/>
                        </StackPanel>

                    </StackPanel>
                </Grid>
            </Border>

            <Image Source="Images/callout_bottom.png" Stretch="None"/>
        </StackPanel>
        <Image x:Name="btnClose" 
               Source="Images/CancelButton.png" 
               Stretch="None" 
               Margin="0,4,4,0"
               HorizontalAlignment="Right" 
               MouseLeftButtonUp="OnCloseButton" 
               VerticalAlignment="Top"/>
    </Grid>
</UserControl>
